package com.example.myspringbootproject.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.myspringbootproject.mapper.CourseMapper;
import com.example.myspringbootproject.mapper.TeacherMapper;
import com.example.myspringbootproject.pojo.T_course;
import com.example.myspringbootproject.pojo.T_teacher;
import com.example.myspringbootproject.service.impl.CourseServiceImpl;
import com.example.myspringbootproject.service.impl.TeacherServiceImpl;
import com.example.myspringbootproject.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/exam/teacher")
public class teacherController {
    @Autowired
    @Lazy
    TeacherServiceImpl teacherService;
    private T_teacher three;
    @Autowired
    TeacherMapper teacherMapper;
    /**
     * 获取用户列表
     */
    @GetMapping(value = "/list")

    public Result list(int currentPage, int pageSize, String content) {
        System.out.println("当前页："+currentPage+"查询条数："+pageSize+"查询条件"+content);
        //条件查询
        QueryWrapper<T_teacher> qw = new QueryWrapper<>();


        Page<T_teacher> page = new Page<>(currentPage,pageSize);
        IPage<T_teacher> page1 = teacherService.page(page,qw);


        Map<String, Object> map = new HashMap<>();
        map.put("list", page1.getRecords());
        map.put("total", page1.getTotal());

        return Result.ok(map);

    }
}
